﻿<navigation:Page x:Class="SampleBrowser.Views.SampleImages" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:doc="http://schemas.firstfloorsoftware.com/documenttoolkit"
           xmlns:sample="clr-namespace:SampleBrowser.Commands"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Image Viewer">
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="136" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock x:Name="HeaderText" Grid.ColumnSpan="2" Style="{StaticResource HeaderTextStyle}" Text="Image Viewer"/>
        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Text="Select a JPEG, PNG or TIFF image from disk" Margin="0,0,0,4" />

        <doc:DocumentDataSource x:Name="DataSource" LoadError="DataSource_LoadError">
            <doc:DocumentDataSource.LoadDocumentSettings>
                <doc:LoadXpsDocumentSettings ImageMaxSize="9999,9999" />
            </doc:DocumentDataSource.LoadDocumentSettings>
            <doc:DocumentDataSource.LoadPageSettings>
                <doc:LoadFixedPageSettings AllowAsyncLoadImage="True" />
            </doc:DocumentDataSource.LoadPageSettings>
        </doc:DocumentDataSource>

        <doc:ThumbnailListBox x:Name="Thumbnails" Grid.Row="2" DocumentDataSource="{Binding ElementName=DataSource}" PageIndex="{Binding PageIndex, Mode=TwoWay, ElementName=Navigator}" />

        <doc:DocumentViewer x:Name="Viewer"
                            Grid.Column="1" Grid.Row="2"
                            DocumentDataSource="{Binding ElementName=DataSource}"
                            ViewMode="{Binding SelectedViewMode, ElementName=ViewModePicker}">
        </doc:DocumentViewer>
        <StackPanel Grid.ColumnSpan="2" Grid.Row="3" Orientation="Horizontal" Margin="0,8,0,0" HorizontalAlignment="Center">
            <doc:PageNavigator x:Name="Navigator"
                               PageCount="{Binding PageCount, ElementName=Viewer}"
                               PageIndex="{Binding PageIndex, ElementName=Viewer, Mode=TwoWay}"
                               Margin="4,0,0,0" />
            <doc:ViewModePicker x:Name="ViewModePicker" Margin="4,0,0,0" />

            <Button Margin="4,0,0,0" Padding="7">
                <Button.Command>
                    <sample:OpenImageFromDiskCommand DocumentDataSource="{Binding ElementName=DataSource}" />
                </Button.Command>
                <Button.Content>
                    <Image Source="/SampleBrowser;component/Assets/Icons/open.png" />
                </Button.Content>
            </Button>

        </StackPanel>
    </Grid>
</navigation:Page>
